home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / ole2book.zip / CHAP07.ZIP / CHAP07 / SCHMOO / SCHMOO.H < prev    next >
C/C++ Source or Header  |  1993-04-21  |  4KB  |  170 lines

  1. /*
  2.  * SCHMOO.H
  3.  * Chapter 7 Modification
  4.  *
  5.  * Single include file that pulls in everything needed for other source
  6.  * files in the Schmoo application.
  7.  *
  8.  * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
  9.  *
  10.  * Kraig Brockschmidt, Software Design Engineer
  11.  * Microsoft Systems Developer Relations
  12.  *
  13.  * Internet  :  kraigb@microsoft.com
  14.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  15.  */
  16.  
  17.  
  18. #ifndef _SCHMOO_H_
  19. #define _SCHMOO_H_
  20.  
  21. #include <windows.h>
  22. #include <memory.h>
  23. #include <ole2.h>   //Required for storage use
  24. #include <ole2ver.h>
  25. #include <bookguid.h>
  26.  
  27. //These include files reference DLLs that don't have extern "C" already
  28. extern "C"
  29.     {
  30.     #include <commdlg.h>
  31.     }
  32.  
  33. #include <classlib.h>
  34. #include "resource.h"
  35.  
  36.  
  37. //Get the editor window information.
  38. #include "polyline.h"
  39.  
  40.  
  41.  
  42. //SCHMOO.CPP:  Frame object that creates a main window
  43.  
  44. class __far CSchmooFrame : public CFrame
  45.     {
  46.     private:
  47.         HBITMAP         m_hBmpLines[5];     //Menu item bitmaps
  48.         BOOL            m_fInitialized;     //Did CoInitalize work?
  49.  
  50.     protected:
  51.         //Overridable for creating a CClient for this frame
  52.         virtual LPCClient CreateCClient(void);
  53.  
  54.         virtual BOOL      FRegisterAllClasses(void);
  55.         virtual BOOL      FPreShowInit(void);
  56.         virtual UINT      CreateGizmos(void);
  57.  
  58.         virtual LRESULT   OnCommand(HWND, WPARAM, LPARAM);
  59.         virtual void      OnDocumentDataChange(LPCDocument);
  60.         virtual void      OnDocumentActivate(LPCDocument);
  61.  
  62.         //New for this class
  63.         virtual void      CreateLineMenu(void);
  64.  
  65.     public:
  66.         CSchmooFrame(HINSTANCE, HINSTANCE, LPSTR, int);
  67.         virtual ~CSchmooFrame(void);
  68.  
  69.         //Overrides
  70.         virtual BOOL      FInit(LPFRAMEINIT);
  71.         virtual void      UpdateMenus(HMENU, UINT);
  72.         virtual void      UpdateGizmos(void);
  73.  
  74.         //New for this class
  75.         virtual void      CheckLineSelection(UINT);
  76.     };
  77.  
  78.  
  79. typedef CSchmooFrame FAR * LPCSchmooFrame;
  80.  
  81.  
  82.  
  83.  
  84.  
  85. //CLIENT.CPP
  86.  
  87. /*
  88.  * The only reason we have a derived class here is to override
  89.  * CreateCDocument so we can create our own type as well as
  90.  * overriding NewDocument to perform one other piece of work once the
  91.  * document's been created.
  92.  */
  93.  
  94. class __far CSchmooClient : public CClient
  95.     {
  96.     protected:
  97.         //Overridable for creating a new CDocument
  98.         virtual LPCDocument CreateCDocument();
  99.  
  100.     public:
  101.         CSchmooClient(HINSTANCE);
  102.         virtual ~CSchmooClient(void);
  103.  
  104.         virtual LPCDocument NewDocument(BOOL, LPCDocumentAdviseSink);
  105.     };
  106.  
  107.  
  108. typedef CSchmooClient FAR * LPCSchmooClient;
  109.  
  110.  
  111.  
  112.  
  113. //DOCUMENT.CPP
  114.  
  115. //Constant ID for the window polyline that lives in a document window
  116. #define ID_POLYLINE         10
  117.  
  118. class __far CSchmooDoc : public CDocument
  119.     {
  120.     friend class CPolylineAdviseSink;
  121.  
  122.     protected:
  123.         UINT            m_uPrevSize;        //Last WM_SIZE wParam
  124.         LONG            m_lVer;             //Loaded Polyline version
  125.  
  126.         LPCPolyline             m_pPL;      //Polyline Editor window in us.
  127.         LPCPolylineAdviseSink   m_pPLAdv;   //Advises from Polyline
  128.  
  129.     protected:
  130.         virtual BOOL    FMessageHook(HWND, UINT, WPARAM, LPARAM, LRESULT FAR *);
  131.  
  132.         //CHAPTER7MOD
  133.         virtual BOOL    FQueryPasteFromData(LPDATAOBJECT);
  134.         virtual BOOL    FPasteFromData(LPDATAOBJECT);
  135.         //End CHAPTER7MOD
  136.  
  137.     public:
  138.         CSchmooDoc(HINSTANCE);
  139.         virtual ~CSchmooDoc(void);
  140.  
  141.         virtual BOOL     FInit(LPDOCUMENTINIT);
  142.  
  143.         virtual void     Clear();
  144.  
  145.         virtual UINT     ULoad(BOOL, LPSTR);
  146.         virtual UINT     USave(UINT, LPSTR);
  147.  
  148.         virtual void     Undo(void);
  149.         virtual BOOL     FClip(HWND, BOOL);
  150.         virtual HGLOBAL  RenderFormat(UINT);
  151.         virtual BOOL     FQueryPaste(void);
  152.         virtual BOOL     FPaste(HWND);
  153.  
  154.         virtual COLORREF ColorSet(UINT, COLORREF);
  155.         virtual COLORREF ColorGet(UINT);
  156.  
  157.         virtual UINT     LineStyleSet(UINT);
  158.         virtual UINT     LineStyleGet();
  159.     };
  160.  
  161. typedef CSchmooDoc FAR * LPCSchmooDoc;
  162.  
  163.  
  164. //These color indices wrap the polyline definitions
  165. #define DOCCOLOR_BACKGROUND             POLYLINECOLOR_BACKGROUND
  166. #define DOCCOLOR_LINE                   POLYLINECOLOR_LINE
  167.  
  168.  
  169. #endif //_SCHMOO_H_
  170.